﻿{$header}
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">编辑销售分单 [ <a href="__URL__">返回列表</a> ]</h3>
<div id="result" class="result none"></div>
<form class="form-horizontal well" method='post' id="form1" action="__APP__/Order_detail/update/">
<table cellpadding=3 cellspacing=3 >
<tr>
	<td class="tRight" >销售单号：</td>
	<td class="tLeft" >{$vo.mano}</td>
</tr>
<tr>
	<td class="tRight" >经办人：</td>
	<td class="tLeft" >
            {$vo.user_id|getModelName=User}&nbsp;&nbsp; &nbsp;&nbsp;创建时间：{$vo.create_time|toDate}
        </td>
</tr>
<tr>
	<td class="tRight" >产品：</td>
	<td class="tLeft" >
            {$vo.product_id|getModelName=Product}
        </td>
</tr>
<tr>
	<td class="tRight" >规格：</td>
	<td class="tLeft" >
            {$vo.specification|modList='Specification',###,'span3','specification'}
        </td>
</tr>
<tr>
	<td class="tRight" >单价：</td>
	<td class="tLeft" >
            <input type="text" value="{$vo.price}" name="price">
        </td>
</tr>
<tr>
	<td class="tRight" >数量：</td>
	<td class="tLeft" >
            <input type="text" value="{$vo.number}" name="number">
        </td>
</tr>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
<tr>
	<td class="tRight" >要求交货期：</td>
	<td class="tLeft" >
            <input type="text" value="{$vo.delivery_date|toDate='Y-m-d'}" name="delivery_date" onClick="WdatePicker()">
        </td>
</tr>
<tr>
	<td>状态</td><td>{$vo.status|getConfigVal='orderDetailStatus'}</td>
</tr>
<tr>
	<td>操作</td><td>{$vo.id|getActionButton}</td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
	<td></td>
	<td class="center" width="300">
        <input type="hidden" value="{$vo.id}" name="id">
	<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> 保存</button>
	<button type="reset" onclick="javascript:history.back()" class="btn btn-primary offset1"><i class="icon-arrow-left icon-white"></i> 返回</button>
	</td>
</tr>
</table>
</form>
<table class="table table-bordered table-striped table-striped">
	<tr>
		<td>{$vo.product_id|getModelName=Product}  </td><td>{$vo.product_id|getPename}    <b class="offset1">CAS:{$vo.product_id|getCas} </b> 库存</td>
	</tr>
	<tr>
		<th>规格</th><th>库存</th>
	</tr>
	<volist name="stocks" id="st">
		<tr>
			<td>{$st.specification|getModelName='Specification'}</td><td>{$st.number}</td>
		</tr>	
	</volist>
	
</table>
</div>
</div>

<php>
function getActionButton($id){
	$sod = M('Order_detail');
	$sod ->getById($id);
	$status = $sod->status;
	switch($status){
		case 0: 	//待确定
			echo "<a href='__APP__/Buy/add/id/".$id."'>库存不足，发布采购任务</a>  | <a href='__APP__/Order_detail/setFieldValue/id/".$id."/new/4' class='offset1'>仓库操作中</a>";
			break;
		case 1:
		case 2: 	//待采购
			echo "---";
			break;
		case 3: 	//到货通知
			echo "<a href='__APP__/Order_detail/setFieldValue/id/".$id."/new/4'>仓库操作中</a>";
			break;
		case 4: 	//到货通知
			echo "<a href='__URL__/doshipping/id/".$id."'>打包</a>";
			break;
		default:
			echo "---";
}
}
</php>

